﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<head>

    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>Home</title>

    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
    <link rel="stylesheet" href="assets/materialize/css/materialize.min.css" media="screen,projection"/>
    <!-- Bootstrap Styles-->
    <link href="assets/css/bootstrap.css" rel="stylesheet"/>
    <!-- FontAwesome Styles-->
    <link href="assets/css/font-awesome.css" rel="stylesheet"/>
    <!-- Morris Chart Styles-->
    <link href="assets/js/morris/morris-0.4.3.min.css" rel="stylesheet"/>
    <!-- Custom Styles-->
    <link href="assets/css/custom-styles.css" rel="stylesheet"/>
    <!--&lt;!&ndash; Google Fonts&ndash;&gt;-->
    <!--<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'/>-->
    <!--<link rel="stylesheet" href="assets/js/Lightweight-Chart/cssCharts.css">-->
</head>

<body>

<div id="wrapper">
    <nav class="navbar navbar-default top-navbar" role="navigation">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle waves-effect waves-dark" data-toggle="collapse"
                    data-target=".sidebar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand waves-effect waves-dark" th:href="@{/}"><i
                    class="large material-icons">insert_chart</i>
                <strong>Lger 会员系统</strong></a>

            <div id="sideNav" href=""><i class="material-icons dp48">toc</i></div>
        </div>
        <!--用户登录信息-->
        <ul class="nav navbar-top-links navbar-right">
            <li><a class="dropdown-button waves-effect waves-dark" href="#" data-activates="dropdown1"><i
                    class="fa fa-user fa-fw"></i> <b th:unless="${session.admin == null}" th:text="${session.admin.username}"></b> <i
                    class="material-icons right">arrow_drop_down</i></a></li>
        </ul>
    </nav>
    <!--用户登录栏的具体信息-->
    <ul id="dropdown1" class="dropdown-content">
        <li><a th:href="@{/myAccount}"><i class="fa fa-user fa-fw"></i>我的账户</a>
        </li>
        <li><a th:href="@{/logout}"><i class="fa fa-sign-out fa-fw"></i>退出登录</a>
        </li>
    </ul>
    <!--侧边栏-->
    <nav class="navbar-default navbar-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav" id="main-menu">

                <li>
                    <a class="waves-effect waves-dark" th:href="@{/}"><i class="fa fa-dashboard"></i>
                        首页</a>
                </li>

                <li class="active">
                    <a th:href="@{/myAccount}" class="active-menu waves-effect waves-dark"><i class="fa fa-user"></i>
                        管理员信息</a>
                </li>

                <li>
                    <a class="waves-effect waves-dark" th:href="@{/addAdmin}"><i class="fa fa-plus"></i>
                        添加管理员</a>
                </li>

                <li>
                    <a class="waves-effect waves-dark" th:href="@{/deleteAdmin}"><i class="fa fa-minus"></i>
                        删除管理员</a>
                </li>
            </ul>

        </div>

    </nav>
    <!--内容主体-->
    <div id="page-wrapper">
        <!--内容主题-->
        <div class="header">
            <h1 class="page-header">
                会员类别
            </h1>
        </div>
        <div id="page-inner">
            <!--自定义内容-->
            <div class="card">
                <div class="card-content">

                    <div class="row">
                        <div class="input-field col s6">
                            <span>用户名：</span>
                        </div>
                        <div class="input-field col s6">
                            <input id="username" name="username" type="text" th:value="${session.admin.username}" class="validate valid" placeholder="用户名" required/>
                            <label for="username" class="active">用户名</label>
                        </div>
                    </div>
                    <div class="row">
                        <div class="input-field col s6">
                            <span>密码：</span>
                        </div>
                        <div class="input-field col s6">
                            <input id="password" name="password" type="text" th:value="${session.admin.username}" class="validate valid" placeholder="密码" required/>
                            <label for="password" class="active">密码</label>
                        </div>
                    </div>

                    <div class="row">
                        <div class="input-field col s6">
                            <span>邮箱：</span>
                        </div>
                        <div class="input-field col s6">
                            <input id="email" name="email" type="text" th:value="${session.admin.email}" class="validate valid" placeholder="邮箱" required/>
                            <label for="email" class="active">邮箱</label>
                        </div>
                    </div>
                    <div class="row">
                        <div class="input-field col s6">
                            <span>联系电话：</span>
                        </div>
                        <div class="input-field col s6">
                            <input id="phone" name="phone" type="text" th:value="${session.admin.phone}" class="validate valid" placeholder="电话" required/>
                            <label for="phone" class="active">电话</label>
                        </div>
                    </div>

                </div>
                <div class="card-action">
                    <a href="javascript:void(0)" onclick="modify()">修改</a>
                </div>
            </div>
            <!--页脚-->
            <br>
            <br>
            <br>
            <footer><p class="text-center">Copyright &copy; 2017.Company name All rights reserved.</p></footer>
        </div>

    </div>
</div>


<!-- JS Scripts-->
<!-- jQuery Js -->
<script src="assets/js/jquery-1.10.2.js"></script>

<!-- Bootstrap Js -->
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/materialize/js/materialize.min.js"></script>
<!-- Metis Menu Js -->
<script src="assets/js/jquery.metisMenu.js"></script>

<script src="assets/js/easypiechart.js"></script>
<script src="assets/js/easypiechart-data.js"></script>

<script src="assets/js/Lightweight-Chart/jquery.chart.js"></script>

<!-- Custom Js -->
<script src="assets/js/custom-scripts.js"></script>

<script>

    function modify() {
        var email = document.getElementById('email').value;
        var username = document.getElementById('username').value;
        var phone = document.getElementById('phone').value;
        var password = document.getElementById('password').value;
        if (confirm('确认修改？')) {
            $.ajax({
                url: '/modifyAdmin',
                type: 'POST',
                data:{email:email,password:password,username:username, phone:phone},
                success: function (data) {
                    alert(data);
                }

            })
        }
    }

</script>

</body>

</html>